package models

import (
	"github.com/jinzhu/gorm"
	"yanwc.gokit/user_svc/common"
)

type LoginType string

const (
	UserNameAndPassword LoginType = "userNameAndPassword"
	Email LoginType= "email"
	Cellphone LoginType= "cellphone"
)

func (l *LoginType) GetAllTypes() []common.LabelValue {
	return []common.LabelValue{
		{Label: "用户名密码", Value: "UserNameAndPassword"},
		{Label: "邮箱", Value: "email"},
		{Label: "电话号码", Value: "cellphone"},
	}
}

//用户登录账号
type Account struct {
	gorm.Model
	LoginName string
	LoginType LoginType
	Password string
	Enable bool
	SubSystemId uint `gorm:"default 0 "`
	User User `gorm:"foreignkey:userId"`
	UserId uint
}